<?php

namespace app\common\service\order\order_status\items;

use app\model\CouponOrder;

class OrderStatusRefund extends OrderStatusBase
{
    public static function handle(CouponOrder $couponOrder, $next)
    {

//        if ($couponOrder->pay_status == CouponOrder::C_PAY_STATUS_YES && in_array($couponOrder->status, [CouponOrder::C_STATUS_SUBMIT_FAIL, CouponOrder::C_STATUS_RECHARGE_FAIL])) {
//            //去掉美团  原因：https://pic.rmb.bdstatic.com/bjh/6823e7ecfb1d2ba5424c087d73741e10.png
//            if (in_array($couponOrder->serv_type,[PRODUCT_ELE_SERV,PRODUCT_SECKILL_SERV,PRODUCT_METUAN_SERV])  ){
//                return $couponOrder->params['return_status'] = self::getReturnStatus(self::INVALID);
//            }
//
////            return $couponOrder->params['return_status'] = self::getReturnStatus(self::RERUND_SUCCESS, '已退款');
//
//        }

        if (in_array($couponOrder->refund_status,[CouponOrder::C_REFUND_STATUS_HAVE,CouponOrder::C_REFUND_STATUS_ING]) ) {
            return $couponOrder->params['return_status'] = self::getReturnStatus(self::RERUND_SUCCESS, '已退款');
        }


        return $next($couponOrder);
    }
}